




<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        textarea{
            display: inline-block;
            margin: 30px ;
            height: 300px;
            width: 200px;
            padding: 10px;
        }
    </style>
</head>
<body>

    <textarea id="oldVnode">
        
    </textarea>

    <textarea id="newVnode">
        {
            "tag":"div",
            "children":[{
                "text":"3333"
            }]
        }
    </textarea>

   <button id="parse">解析</button>

   <div></div>

   <script src="./app.js"></script>

    <script>

        document.getElementById("parse").onclick=function(){

            var oldVnode = document.getElementById("oldVnode").value.trim()
            var newVnode = document.getElementById("newVnode").value.trim()

            oldVnode= oldVnode && JSON.parse(oldVnode.trim())
            newVnode= newVnode && JSON.parse(newVnode.trim())

            var patch = createPatchFunction()

            console.log(patch(oldVnode,newVnode,document.getElementsByTagName("div")[0]))
        }
    </script>
    
</body>
</html>